Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status #84

Merged
merged 6 commits into from
Dec 9, 2024
Merged

Status #84

merged 6 commits into from
Dec 9, 2024

Conversation

austenstone
Copy link
Owner

No description provided.

Copy link

github-actions bot commented Dec 6, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

@@ -1,6 +1,6 @@
import { Endpoints } from '@octokit/types';
import { Seat } from "../models/copilot.seats.model.js";
import { QueryTypes, Sequelize } from 'sequelize';
import { Op, QueryTypes, Sequelize } from 'sequelize';

Check failure

Code scanning / ESLint

Disallow unused variables Error

'QueryTypes' is defined but never used.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to remove the unused QueryTypes import from the file. This will resolve the ESLint error and clean up the code. The change should be made in the backend/src/services/copilot.seats.service.ts file, specifically on line 3.

Suggested changeset 1
backend/src/services/copilot.seats.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/backend/src/services/copilot.seats.service.ts b/backend/src/services/copilot.seats.service.ts
--- a/backend/src/services/copilot.seats.service.ts
+++ b/backend/src/services/copilot.seats.service.ts
@@ -2,3 +2,3 @@
 import { Seat } from "../models/copilot.seats.model.js";
-import { Op, QueryTypes, Sequelize } from 'sequelize';
+import { Op, Sequelize } from 'sequelize';
 import { components } from "@octokit/openapi-types";
EOF
@@ -2,3 +2,3 @@
import { Seat } from "../models/copilot.seats.model.js";
import { Op, QueryTypes, Sequelize } from 'sequelize';
import { Op, Sequelize } from 'sequelize';
import { components } from "@octokit/openapi-types";
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
import { MetricsService } from '../../../services/api/metrics.service';
import { CopilotMetrics } from '../../../services/api/metrics.service.interfaces';
import { ActivityResponse, Seat, SeatService } from '../../../services/api/seat.service';
import { MembersService } from '../../../services/api/members.service';
import { CopilotSurveyService, Survey } from '../../../services/api/copilot-survey.service';
import { forkJoin, takeUntil } from 'rxjs';
import { forkJoin, Subject, Subscription, takeUntil } from 'rxjs';

Check failure

Code scanning / ESLint

Disallow unused variables Error

'forkJoin' is defined but never used.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to remove the unused forkJoin import from the file. This will resolve the ESLint error and clean up the code. The change should be made in the frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts file, specifically on line 9 where forkJoin is imported.

Suggested changeset 1
frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts b/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
--- a/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
+++ b/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
@@ -8,3 +8,3 @@
 import { CopilotSurveyService, Survey } from '../../../services/api/copilot-survey.service';
-import { forkJoin, Subject, Subscription, takeUntil } from 'rxjs';
+import { Subject, Subscription, takeUntil } from 'rxjs';
 import { AdoptionChartComponent } from '../copilot-value/adoption-chart/adoption-chart.component';
EOF
@@ -8,3 +8,3 @@
import { CopilotSurveyService, Survey } from '../../../services/api/copilot-survey.service';
import { forkJoin, Subject, Subscription, takeUntil } from 'rxjs';
import { Subject, Subscription, takeUntil } from 'rxjs';
import { AdoptionChartComponent } from '../copilot-value/adoption-chart/adoption-chart.component';
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options

activityTotals?: Record<string, number>;
status?: any;

Check failure

Code scanning / ESLint

Disallow the `any` type Error

Unexpected any. Specify a different type.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to replace the any type with a more specific type that accurately represents the data that the status variable is expected to hold. This will improve type safety and make the code easier to understand and maintain.

In this case, we can infer from the context that status might be an object with specific properties. We should define an appropriate interface or type alias for this object and use it instead of any.

Suggested changeset 1
frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts b/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
--- a/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
+++ b/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
@@ -76,3 +76,3 @@
   activityTotals?: Record<string, number>;
-  status?: any;
+  status?: { [key: string]: string | number | boolean };
   statuses = [] as {
EOF
@@ -76,3 +76,3 @@
activityTotals?: Record<string, number>;
status?: any;
status?: { [key: string]: string | number | boolean };
statuses = [] as {
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
this.status = status;
this.statuses[0] = {
title: 'GitHub App',
message: status.installations.reduce((acc: number, i: any) => acc += i.repos.length, 0) + ' repositories',

Check failure

Code scanning / ESLint

Disallow the `any` type Error

Unexpected any. Specify a different type.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to replace the any type with a more specific type that accurately represents the structure of the i variable. This involves defining an interface that describes the expected properties of i and then using this interface in place of any. Specifically, we need to define an interface for the installation object that includes a repos property, which is an array. We will then use this interface in the reduce function to ensure type safety.

Suggested changeset 1
frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts b/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
--- a/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
+++ b/frontend/src/app/main/copilot/copilot-dashboard/dashboard.component.ts
@@ -15,2 +15,5 @@
 import { StatusComponent } from './status/status.component';
+interface Installation {
+  repos: { length: number }[];
+}
 
@@ -128,3 +131,3 @@
             title: 'GitHub App',
-            message: status.installations.reduce((acc: number, i: any) => acc += i.repos.length, 0) + ' repositories',
+            message: status.installations.reduce((acc: number, i: Installation) => acc += i.repos.length, 0) + ' repositories',
             status: status.installations.length > 0 ? 'success' : 'error'
EOF
@@ -15,2 +15,5 @@
import { StatusComponent } from './status/status.component';
interface Installation {
repos: { length: number }[];
}

@@ -128,3 +131,3 @@
title: 'GitHub App',
message: status.installations.reduce((acc: number, i: any) => acc += i.repos.length, 0) + ' repositories',
message: status.installations.reduce((acc: number, i: Installation) => acc += i.repos.length, 0) + ' repositories',
status: status.installations.length > 0 ? 'success' : 'error'
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
import { DateRangeSelectComponent } from "../../../shared/date-range-select/date-range-select.component";
import { MetricsService } from '../../../services/api/metrics.service';
import { CopilotMetrics } from '../../../services/api/metrics.service.interfaces';
import { CopilotMetricsPieChartComponent } from './copilot-metrics-pie-chart/copilot-metrics-pie-chart.component';
import { MatCardModule } from '@angular/material/card';
import { Installation, InstallationsService } from '../../../services/api/installations.service';
import { takeUntil } from 'rxjs';
import { forkJoin, Subject, Subscription, takeUntil } from 'rxjs';

Check failure

Code scanning / ESLint

Disallow unused variables Error

'forkJoin' is defined but never used.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to remove the unused forkJoin import from the file. This will resolve the ESLint error and clean up the code. The change is straightforward and involves deleting the forkJoin import from the import statement on line 8.

Suggested changeset 1
frontend/src/app/main/copilot/copilot-metrics/copilot-metrics.component.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/main/copilot/copilot-metrics/copilot-metrics.component.ts b/frontend/src/app/main/copilot/copilot-metrics/copilot-metrics.component.ts
--- a/frontend/src/app/main/copilot/copilot-metrics/copilot-metrics.component.ts
+++ b/frontend/src/app/main/copilot/copilot-metrics/copilot-metrics.component.ts
@@ -7,3 +7,3 @@
 import { Installation, InstallationsService } from '../../../services/api/installations.service';
-import { forkJoin, Subject, Subscription, takeUntil } from 'rxjs';
+import { Subject, Subscription, takeUntil } from 'rxjs';
 import { DashboardCardBarsComponent } from '../copilot-dashboard/dashboard-card/dashboard-card-bars/dashboard-card-bars.component';
EOF
@@ -7,3 +7,3 @@
import { Installation, InstallationsService } from '../../../services/api/installations.service';
import { forkJoin, Subject, Subscription, takeUntil } from 'rxjs';
import { Subject, Subscription, takeUntil } from 'rxjs';
import { DashboardCardBarsComponent } from '../copilot-dashboard/dashboard-card/dashboard-card-bars/dashboard-card-bars.component';
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
});
}

dateRangeChange(event: {start: Date, end: Date}) {
ngOnDestroy() {

Check warning

Code scanning / ESLint

Ensures that classes implement lifecycle interfaces corresponding to the declared lifecycle methods. See more at https://angular.dev/style-guide#style-09-01 Warning

Lifecycle interface 'OnDestroy' should be implemented for method 'ngOnDestroy'. (https://angular.dev/style-guide#style-09-01)
});
}

ngOnDestroy() {

Check warning

Code scanning / ESLint

Ensures that classes implement lifecycle interfaces corresponding to the declared lifecycle methods. See more at https://angular.dev/style-guide#style-09-01 Warning

Lifecycle interface 'OnDestroy' should be implemented for method 'ngOnDestroy'. (https://angular.dev/style-guide#style-09-01)
@@ -1,4 +1,4 @@
import { Injectable, OnDestroy } from '@angular/core';
import { Injectable, OnDestroy, OnInit } from '@angular/core';

Check failure

Code scanning / ESLint

Disallow unused variables Error

'OnInit' is defined but never used.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to remove the unused OnInit import from the file. This will resolve the ESLint error and clean up the code by removing unnecessary imports.

  • Locate the import statement on line 1 in the file frontend/src/app/services/api/installations.service.ts.
  • Remove the OnInit import from the import statement.
Suggested changeset 1
frontend/src/app/services/api/installations.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/services/api/installations.service.ts b/frontend/src/app/services/api/installations.service.ts
--- a/frontend/src/app/services/api/installations.service.ts
+++ b/frontend/src/app/services/api/installations.service.ts
@@ -1,2 +1,2 @@
-import { Injectable, OnDestroy, OnInit } from '@angular/core';
+import { Injectable, OnDestroy } from '@angular/core';
 import { BehaviorSubject, of, Subject, tap } from 'rxjs';
EOF
@@ -1,2 +1,2 @@
import { Injectable, OnDestroy, OnInit } from '@angular/core';
import { Injectable, OnDestroy } from '@angular/core';
import { BehaviorSubject, of, Subject, tap } from 'rxjs';
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -72,5 +73,8 @@
localStorage.setItem('installation', id.toString());
}

getStatus2() {
return this.http.get<any>(`${serverUrl}/api/status`);

Check failure

Code scanning / ESLint

Disallow the `any` type Error

Unexpected any. Specify a different type.

Copilot Autofix AI about 2 months ago

To fix the problem, we need to replace the any type with a more specific type that accurately represents the data returned by the API endpoint. This involves defining a new interface or type that matches the structure of the response from the ${serverUrl}/api/status endpoint. We will then use this new type in the getStatus2 method.

  1. Define a new interface StatusResponse2 that matches the structure of the response from the ${serverUrl}/api/status endpoint.
  2. Update the getStatus2 method to use the new StatusResponse2 type instead of any.
Suggested changeset 1
frontend/src/app/services/api/installations.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/services/api/installations.service.ts b/frontend/src/app/services/api/installations.service.ts
--- a/frontend/src/app/services/api/installations.service.ts
+++ b/frontend/src/app/services/api/installations.service.ts
@@ -19,2 +19,10 @@
 
+export interface StatusResponse2 {
+  // Define the structure of the response here
+  // For example:
+  isSetup: boolean;
+  dbConnected: boolean;
+  installations: InstallationStatus[];
+}
+
 export type Installations = Endpoints["GET /app/installations"]["response"]["data"]
@@ -75,3 +83,3 @@
   getStatus2() {
-    return this.http.get<any>(`${serverUrl}/api/status`);
+    return this.http.get<StatusResponse2>(`${serverUrl}/api/status`);
   }
EOF
@@ -19,2 +19,10 @@

export interface StatusResponse2 {
// Define the structure of the response here
// For example:
isSetup: boolean;
dbConnected: boolean;
installations: InstallationStatus[];
}

export type Installations = Endpoints["GET /app/installations"]["response"]["data"]
@@ -75,3 +83,3 @@
getStatus2() {
return this.http.get<any>(`${serverUrl}/api/status`);
return this.http.get<StatusResponse2>(`${serverUrl}/api/status`);
}
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
…ormatting and commenting out unused scatter series code
…date styles in status.component.scss for better visibility; comment out GitHub repository link in settings.component.html for future reference.
@austenstone austenstone merged commit f0e48a4 into main Dec 9, 2024
10 of 11 checks passed
@austenstone austenstone deleted the status branch December 9, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant